<div >
	<div id="iconList_adddiv" class="dropdown pull-right" style="width:100%;top: 40px;">
      <section class="dropdown-menu on aside-md m-l-n" style="width:100%;">
        <section class="panel bg-white">
            <form id="iconList_addform" class="form-inline" role="form">
					<header class="panel-heading">
						<div class="form-group">
							<input type="text" name="name"
								class="form-control" style="width: 80px;" placeholder="名称">
						</div>
						<div class="form-group" data-toggle="collapse"
							data-parent="#iconList_ul" href="#iconList_collapse0">
							<img
								src=""
								style="width: 60px; height: 34px;">
						</div>
						<div class="form-group">
							<input type="text"
								name="img" class="form-control" style="width: 140px;"
								placeholder="图片路径">
						</div>
						<div class="form-group">
						<!-- 			//1.load加载url;2.iframe加载url;3.script执行脚本;4.快捷方式（实现方式未知） -->
							<select name="type" class="form-control" style="width: 80px;">
                            	<option value="1">load</option>
                            	<option value="2">iframe</option>
                            	<option value="3">脚本</option>
                            	<option value="4">快捷方式</option>
                          	</select>
						</div>
						<div class="form-group">
							<input type="text"  name="height"
								class="form-control" style="width: 60px;" placeholder="高度">
						</div>
						<div class="form-group">
							<input type="text"  name="width"
								class="form-control" style="width: 60px;" placeholder="宽度">
						</div>
						<button type="submit" class="btn btn-info">添加</button>
					</header>
					<div class="panel-body">
						<textarea rows="5" name="content" class="form-control" placeholder="內容"></textarea>
					</div>
			 </form>
        </section>
      </section>
    </div>
	<ul id="iconList_ul" class="list-group gutter">
	  <li class="list-group-item"> 
	  	<label style="width: 80px;">名称</label>
	  	<label style="width: 60px;">图标</label>
	  	<label style="width: 140px;">图标路径</label>
	  	<label style="width: 80px;">类型</label>
	  	<label style="width: 60px;">宽度</label>
	  	<label style="width: 60px;">高度</label>
	  	<label style="width: 55px;"></label>
  		<a data-toggle="dropdown" data-target="#iconList_adddiv" style="position: absolute;top: 5px;right: 15px;" class="btn btn-sm btn-icon btn-info"><i class="fa fa-plus"></i></a>

	  	
	  </li>
	</ul>
	<script type="text/javascript">
		function iconList_ul_delete(id){
			$h.post("userIcon/delete",{id:id},function(json){
				alert(json.msg);
				showcontentinid('sysset_index_content','page/sysset/iconList.html');
    			index_ico_init();//刷新桌面图标
			});
		}
	
		$(function(){
			$("#iconList_addform").submit(function(){
				$h.ajaxSubmit($(this),{  
			    	   url: "userIcon/save",                 //默认是form的action， 如果申明，则会覆盖  
			    	   type: "post",               //默认是form的method（get or post），如果申明，则会覆盖  
			    	   success: function(data){//提交后的回调函数  
			    		   	alert(data.msg);
			    			showcontentinid('sysset_index_content','page/sysset/iconList.html');
			    			index_ico_init();//刷新桌面图标
			    	   }      
			    }); 
				return false;
			});
			$h.post("userIcon/findList",function(json){
				if(json.code==0){
					//桌面图标初始化
					var list = json.data;
					for(var i=0;i<list.length;i++){
						var li =["<li class=\"panel panel-default pos-rlt\" style=\"border-radius: 0px; margin-bottom: 0px;\">",
							"<form class=\"form-inline\" role=\"form\">",
							"  <header class=\"panel-heading\">",
							"    <ul class=\"nav nav-pills pull-right\" style=\"margin: auto;\">",
							"      <li class=\"active\"> <a class=\"panel-toggle text-muted active\" style=\"padding: 7px 10px;\"><i class=\"fa fa-caret-down text-active\"></i><i class=\"fa fa-caret-up text\"></i></a> </li>",
							"    </ul>",
							"  	 <input value=\""+list[i].id+"\" name=\"id\" style='display:none;' >",
							"    <div class=\"form-group\">",
							"        <input type=\"text\" required value=\""+list[i].name+"\" name=\"name\" class=\"form-control\" style=\"width: 80px;\" placeholder=\"名称\">",
							"    </div>",
							"    <div class=\"form-group\" data-toggle=\"collapse\" data-parent=\"#iconList_ul\" href=\"#iconList_collapse"+i+"\">",
							"        <img src=\""+list[i].img+"\" style=\"width:60px;height:34px;\" />",
							"    </div>",
							"    <div class=\"form-group\">",
							"        <input type=\"text\" required value=\""+list[i].img+"\" name=\"img\" class=\"form-control\" style=\"width: 140px;\" placeholder=\"图片路径\">",
							"    </div>",
							"    <div class=\"form-group\">",
							"		<select name=\"type\" class=\"form-control\" style=\"width: 80px;\">",
							"              <option value=\"1\" "+(list[i].type==1?"selected=\"selected\"":"")+">load</option>",
							"              <option value=\"2\" "+(list[i].type==2?"selected=\"selected\"":"")+">iframe</option>",
							"              <option value=\"3\" "+(list[i].type==3?"selected=\"selected\"":"")+">脚本</option>",
							"              <option value=\"4\" "+(list[i].type==4?"selected=\"selected\"":"")+">快捷方式</option>",
							"       </select>",
							"    </div>",
							"    <div class=\"form-group\">",
							"        <input type=\"text\" required value=\""+list[i].height+"\" name=\"height\" class=\"form-control\" style=\"width: 60px;\" placeholder=\"高度\">",
							"    </div>",
							"    <div class=\"form-group\">",
							"        <input type=\"text\" required value=\""+list[i].width+"\" name=\"width\" class=\"form-control\" style=\"width: 60px;\" placeholder=\"宽度\">",
							"    </div>",
							"    <button type=\"submit\" class=\"btn btn-default\">保存</button>",
							"    <a onclick=\"iconList_ul_delete("+list[i].id+");\" class=\"btn btn-sm btn-icon btn-danger\"><i class=\"fa fa-trash-o\"></i></a>",
							"  </header>",
							"  <div class=\"panel-body clearfix collapse\">",
							"  	<textarea rows=\"5\" required name=\"content\" placeholder=\"內容\" class=\"form-control\">"+list[i].content+"</textarea>",
							"  </div>",
							"</form>",
							"</li>"].join("");
						["<select name=\"type\" class=\"form-control\" style=\"width: 80px;\">",
							"                            	<option value=\"1\">load</option>",
							"                            	<option value=\"2\">iframe</option>",
							"                            	<option value=\"3\">脚本</option>",
							"                            	<option value=\"4\">快捷方式</option>",
							"                          	</select>"].join("");
						$("#iconList_ul").append(li);
					}
					$("#iconList_ul").find("form").submit(function(){
						$h.ajaxSubmit($(this),{  
					    	   //target: '#output',          //把服务器返回的内容放入id为output的元素中      
					    	   //beforeSubmit: showRequest,  //提交前的回调函数  
					    	   url: "userIcon/update",                 //默认是form的action， 如果申明，则会覆盖  
					    	   type: "post",               //默认是form的method（get or post），如果申明，则会覆盖  
					    	   //dataType: null,           //html(默认), xml, script, json...接受服务端返回的类型  
					    	   //clearForm: true,          //成功提交后，清除所有表单元素的值  
					    	   //resetForm: true,          //成功提交后，重置所有表单元素的值  
					    	   //timeout: 3000,               //限制请求的时间，当请求大于3秒后，跳出请求  
					    	   success: function(data){//提交后的回调函数  
					    		   alert(data.msg);
					    	   }      
					    }); 
					     return false;//阻止表单提交
					});
				}else{
					alert("数据查询失败！");
				}
			});
		});
	</script>
</div>

